#!/bin/echo Warning: this library should be sourced!
function log_info()
{
    echo "[`date +%Y-%m-%d\ %T`] [  INFO ] $@"
}

function log_warn()
{
    echo -e "\033[33m"[`date +%Y-%m-%d\ %T`] [WARNING] $@" \033[0m"
}

function log_error()
{
    echo -e "\033[31m"[`date +%Y-%m-%d\ %T`] [ ERROR ] $@" \033[0m"
    exit 1
}


function log_debug()
{
    [ "$DEBUG" == "yes" ] && echo "[`date +%Y-%m-%d\ %T`] [ DEBUG ] $@"
    echo -n ""
}

function clean_and_exit()
{

    if [ $1 -ne 0 ]; then
        echo "=========error start========="
        cat $ERROR_LOG
        echo "=========error end========="
    fi
    exit $1
}

# 执行评论功能
function exec_comment() {
  log_info "***** Start to exec comment *****"
  python3 /var/jenkins_home/accesscontrol/src/pr_comment.py -p $1 -t "c951fee688f4b037d27602d7461b81fc" -u "https://gitee.com/oepkgs/oepkgs-management.git" -n $2 -c $3
  log_info "***** End to exec comment *****"
}

# 执行入口
function main() {

  exec_comment $1 $2 $3
}
main $1 $2 $3